package src.origintrail;

/**
 * A Character superclass.
 * @author csmythe
 */
public abstract class Character {
    private int health;
    private int hunger;
    private HealthState infectionLevel;
    private String name;
    private static final int MAXHEALTH = 200;
    private static final int MAXHUNGER = 100;
    
    /**
     * Constructor
     */
    public Character(){
        this("");
    }

    /**
     * Constructor for Character.
     * @param name The Character's name
     */
    public Character(String name){
        this(MAXHEALTH, MAXHUNGER, HealthState.HEALTHY, name);
    }

    /**
     * Constructor for a Character.
     * @param health Starting health.
     * @param hunger Starting hunger.
     * @param infectionLevel Starting state of health.
     * @param name Character's name.
     */
    public Character(int health, int hunger, HealthState infectionLevel, String name) {
        this.health = health;
        this.hunger = hunger;
        this.infectionLevel = infectionLevel;
        this.name = name;
    }
    
    /**
     * Initializes this object
     * @param name This character's name
     */
    public void initialize(String name){
        this.name = name;
    }

    /**
     * Adds health. Can be negative.
     * @param amount Amount to add.
     */
    public void addHealth(int amount){
        health += amount;
    }

    /**
     * Getter for health.
     * @return this.health
     */
    public int getHealth() {
        return health;
    }

    /**
     * Setter for health.
     * @param health New health.
     */
    public void setHealth(int health) {
        this.health = health;
    }
    
    /**
     * Getter for hunger.
     * @return this.hunger
     */
    public int getHunger() {
        return hunger;
    }

    /**
     * Setter for hunger.
     * @param hunger New hunger.
     */
    public void setHunger(int hunger) {
        this.hunger = hunger;
    }

    /**
     * Getter for infectionLevel.
     * @return this.infectionLevel
     */
    public HealthState getInfectionLevel() {
        return infectionLevel;
    }

    /**
     * Setter for infectionLevel.
     * @param infectionLevel New infectionLevel.
     */
    public void setInfectionLevel(HealthState infectionLevel) {
        this.infectionLevel = infectionLevel;
    }

    /**
     * Getter for name.
     * @return this.name
     */
    public String getName() {
        return name;
    }

    /**
     * Setter for name.
     * @param name New name.
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Enumeration of Character health states.
     */
    public enum HealthState {

        /**
         * No problems
         */
        HEALTHY,
        /**
         * Driven mad
         */
        INSANE,
        /**
         * Some infected wound
         */
        INFECTED,
        /**
         * Has rabies
         */
        RABID,
        /**
         * Poison from bite
         */
        SNAKEBITE,
        /**
         * Has dysentery
         */
        DYSENTERY,
        /**
         * Has giardia
         */
        GIARDIA,
        /**
         * Collapsed from exhaustion
         */
        EXHAUSTED,
        /**
         * Influenza
         */
        FLU,
        /**
         * Food poisoning
         */
        FPOISON,
        /**
         * Dead
         */
        DEAD
    }
}
